<?php
use yii\helpers\Url;
use yii\web\View;
use app\assets\SyncAsset;
SyncAsset::register($this);
$this->title = $this->context->pageTitle.Yii::$app->params['titleSuffix'];
$this->params['breadcrumbs'] = [
  \Yii::t('common', 'Syncronization'),
  \Yii::t('resource', 'Resource Syncronization')
];
$jsMsgs = $this->context->loadJsMsgs([
  'table',
  'sync',
]);
$this->registerJs("VAM.setVar('LANGUAGE_JS', '".$jsMsgs."');", View::POS_HEAD);
?>
<div class="page-header">
  <h1>
    <?=\Yii::t('common', 'Syncronization')?>
    <small><?=\Yii::t('resource', 'Resource Syncronization')?></small>
  </h1>
</div>
<div class="panel">
  <div class="panel panel-default">
    <div class="panel-heading"> 
      <i class="fa fa-table"></i>
      <?=\Yii::t('resource', 'Syncronization List')?>
      <ul class="list-inline list-unstyled pull-right">
        <li>
          <a class="data-table-refresh" href="#" title="<?=\Yii::t('common', 'Click to refresh data')?>">
            <i class="fa fa-refresh"></i>
          </a>
        </li>
        <li>
          <a href="#">
            <i class="fa fa-chevron-up"></i>
          </a>
        </li>
      </ul>
    </div>
    <div class="panel-body pos-r">
      <div id="list-loading-wrap" class="local-loading-wrap"></div>
      <div class="table-responsive">
        <table class="table table-hover table-striped table-bordered table-condensed" id="data-table" data-tag="vm-adserver.resource-sync-list">
          <thead class="heading">
            <tr>
              <th data-resizable-column-id="id" data-search="on" data-filter="on">ID</th>
              <th data-resizable-column-id="channel" data-search="on" data-filter="on"><?=\Yii::t('resource', 'Market')?></th>
              <th data-resizable-column-id="period" data-search="on" data-filter="on"><?=\Yii::t('resource', 'Syncronization Period')?></th>
              <th data-resizable-column-id="operate" data-filter="on"><?=\Yii::t('resource', 'Actions')?></th>
            </tr>
          </thead>
          <tbody>
            <tr role="row">
              <td class="text-center dataTables_empty" colspan="4"><?=\Yii::t('site', 'No Records')?></td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
  </div>
</div>
<?php
  // $dataUrl = Yii::getAlias('@web').'/response/resourceSync/resourceSyncDataList.php';
  $dataUrl = Url::to(['get-ad-network']);
  $listRefreshOpUrl = Url::to(['list-operate-handle']);
  $this->registerJs("VAM.setVar('DATA_LIST_URL','$dataUrl');", View::POS_HEAD);
  $this->registerJs("VAM.setVar('LIST_REFRESH_OP_URL', '$listRefreshOpUrl')", View::POS_HEAD);
?>
<script type="text/javascript" >
  requirejs(["<?= Yii::getAlias('@web/').Yii::$app->params['envDir'];?>/js/site.js"], function(common) {
    requirejs(["<?= Yii::getAlias('@web/').Yii::$app->params['envDir'];?>/js/resourceSync/resourceSyncList.js"]);
  });
</script>